package reflect;

import java.lang.reflect.Constructor;

/**
 * @description:登录
 * @author: guole
 * @date: 2020/3/27
 */
@MyAnnotation(code = "class-001")
public class UserServiceImpl  implements UserService,TestService{

    public  static  Integer staticNum=1;
    private User user;

    static {
        System.out.println("初始化Class UserService");
    }

   public UserServiceImpl(){
        System.out.println("初始化构造函数 无参数");
    }
    public UserServiceImpl(String name){
        System.out.println("初始化构造函数 有参数:"+name);
    }

    @MyAnnotation(code = "method-001")
    public String login(String name,String password) throws Exception{

        System.out.println(this.getClass().getName()+" login");
        if(name.equals("guole")&&password.equals("111111")){
            return "success";
        }else {
           throw  new Exception ("用户名或密码错误");
         }
     }

    public void privateMethod(){
        System.out.println("私有方法privateMethod");
    }

    public void test() {
        System.out.println("TestService接口的方法");
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
}
